#ifndef DBREGISTER_H_
#define DBREGISTER_H_

#include <iostream>
#include <cstring>

/* registro de la base de datos de acuerdo al enunciado */
struct DBRegister {

public:
	char 	name[61];	/* nombre es la "primary key" */
	char 	address[120];
	char 	phone[13];

	DBRegister () {}

	DBRegister ( const char* name, const char* address, const char* phone ) {
		strcpy(this->name, 		name);
		strcpy(this->address,	address);
		strcpy(this->phone,		phone);
	}

	void operator=(const DBRegister &reg) {
		strcpy(this->name, 		reg.name);
		strcpy(this->address,	reg.address);
		strcpy(this->phone, 	reg.phone);
	}

	/* se consideran el mismo si tienen la misma primary key (nombre) */
	bool operator==(const DBRegister &other) const {
		return strcmp(this->name, other.name) == 0;
	}

	void print() const {
		std::cout<<"\t -- Registro --"<<std::endl;
		std::cout<< "\t >> Nombre:  \t"  	<< name		<<std::endl;
		std::cout<< "\t >> Direccion: \t"	<< address	<<std::endl;
		std::cout<< "\t >> Telefono: \t"	<< phone 	<<std::endl;
		std::cout<<std::endl;
	}

	void setName(const char* name) {
		strcpy(this->name, name);
	}
};


#endif /* REGISTER_H_ */
